const base = '/movieserver'

const holidayConfig = []
module.exports = [{
  url: `${base}/holiday`,
  type: 'post',
  response: config => {
    const { date, type } = config.query
    const typeInt = parseInt(type)
    const arr = holidayConfig.filter(item => item.date === date)
    if (arr && arr.length > 0) {
      arr[0].type = typeInt
    } else {
      holidayConfig.push({
        date: date,
        type: typeInt
      })
    }
    return { success: true }
  }
}, {
  url: `${base}/holiday`,
  type: 'get',
  response: config => {
    const { date } = config.query
    const arr = holidayConfig.filter(item => item.date.substr(0, date.length) === date)
    return { success: true, data: arr }
  }
}]
